<?php



class PeerMapBuilder {

	
	const CLASS_NAME = 'lib.model.map.PeerMapBuilder';

	
	private $dbMap;

	
	public function isBuilt()
	{
		return ($this->dbMap !== null);
	}

	
	public function getDatabaseMap()
	{
		return $this->dbMap;
	}

	
	public function doBuild()
	{
		$this->dbMap = Propel::getDatabaseMap('peergate');

		$tMap = $this->dbMap->addTable('peers');
		$tMap->setPhpName('Peer');

		$tMap->setUseIdGenerator(false);

		$tMap->addPrimaryKey('ID', 'Id', 'string', CreoleTypes::CHAR, true, 20);

		$tMap->addPrimaryKey('INFO_HASH', 'InfoHash', 'string', CreoleTypes::CHAR, true, 20);

		$tMap->addColumn('IP4_1', 'Ip41', 'int', CreoleTypes::TINYINT, false, null);

		$tMap->addColumn('IP4_2', 'Ip42', 'int', CreoleTypes::TINYINT, false, null);

		$tMap->addColumn('IP4_3', 'Ip43', 'int', CreoleTypes::TINYINT, false, null);

		$tMap->addColumn('IP4_4', 'Ip44', 'int', CreoleTypes::TINYINT, false, null);

		$tMap->addColumn('IP4_PORT', 'Ip4Port', 'int', CreoleTypes::SMALLINT, false, null);

		$tMap->addColumn('IP6_1', 'Ip61', 'int', CreoleTypes::SMALLINT, false, null);

		$tMap->addColumn('IP6_2', 'Ip62', 'int', CreoleTypes::SMALLINT, false, null);

		$tMap->addColumn('IP6_3', 'Ip63', 'int', CreoleTypes::SMALLINT, false, null);

		$tMap->addColumn('IP6_4', 'Ip64', 'int', CreoleTypes::SMALLINT, false, null);

		$tMap->addColumn('IP6_5', 'Ip65', 'int', CreoleTypes::SMALLINT, false, null);

		$tMap->addColumn('IP6_6', 'Ip66', 'int', CreoleTypes::SMALLINT, false, null);

		$tMap->addColumn('IP6_7', 'Ip67', 'int', CreoleTypes::SMALLINT, false, null);

		$tMap->addColumn('IP6_8', 'Ip68', 'int', CreoleTypes::SMALLINT, false, null);

		$tMap->addColumn('IP6_PORT', 'Ip6Port', 'int', CreoleTypes::SMALLINT, false, null);

		$tMap->addColumn('ONION', 'Onion', 'string', CreoleTypes::CHAR, false, 16);

		$tMap->addColumn('STATS', 'Stats', 'string', CreoleTypes::CHAR, true, 3);

		$tMap->addColumn('BYTES_UPLOADED', 'BytesUploaded', 'string', CreoleTypes::BIGINT, true, null);

		$tMap->addColumn('BYTES_UPLOAD_OFFSET', 'BytesUploadOffset', 'string', CreoleTypes::BIGINT, true, null);

		$tMap->addColumn('BYTES_DOWNLOAD_OFFSET', 'BytesDownloadOffset', 'string', CreoleTypes::BIGINT, true, null);

		$tMap->addColumn('BYTES_LEFT', 'BytesLeft', 'string', CreoleTypes::BIGINT, true, null);

		$tMap->addColumn('AGENT', 'Agent', 'string', CreoleTypes::VARCHAR, true, 60);

		$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);

		$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);

		$tMap->addColumn('FINISHED_AT', 'FinishedAt', 'int', CreoleTypes::TIMESTAMP, false, null);

	} 
} 